package com.koalton.steward.flow.model;

/**
 * Created by koalton on 2017/7/11.
 */
public enum ItemType {
    /**
     * 收入类条款
     */
    ITEM_TYPE_IN(1, "收入"),
    /**
     * 支出类条款
     */
    ITEM_TYPE_OUT(2, "支出");

    private Integer vlaue;
    private String desc;

    ItemType(Integer itemTypeValue, String itemTypeDesc) {
        this.vlaue = itemTypeValue;
        this.desc = itemTypeDesc;
    }

    public Integer getVlaue() {
        return this.vlaue;
    }

    public String getDesc(){return this.desc;}

    /**
     * 通过ItemType的值返回枚举类型
     *
     * @param value ItemType的值
     * @return ItemType的实例
     */
    public ItemType translate2ItemType(Integer value) {
        switch (value.intValue()) {
            case 1:
                return ITEM_TYPE_IN;
            case 2:
                return ITEM_TYPE_OUT;
            default:
                return null;
        }
    }
}
